<template>
	<view class="general-tasks" :style="otherStyle">
		<view class="model-title">
			<view class="title-dec">{{titleDec}}</view>
			<view class="task-state">{{taskState}}</view>
		</view>
		<view class="maintenance-title">
			<view class="maintenance-title-dec">设备报修</view>
			<view class="equipment-model">{{equipmentModel}}</view>
		</view>
		<view class="hr"></view>
		<view class="form-display">
			<view class="common-style">
				<view class="fault-type">故障类型</view>
				<view class="fault-dec">{{faultDec}}</view>
			</view>
			<view class="common-style">
				<view class="repair-area">报修区域</view>
				<view class="repair-area-dec">{{repairAreaDec}}</view>
			</view>
			<view class="common-style">
				<view class="contact-number">联系电话</view>
				<view class="contact-number-dec">{{contactNumberDec}}</view>
			</view>
		</view>

		<view v-if="tabIndex == 0" class="button">
			<view class="accept" @click="acceptList">确认接单</view>
			<view class="refuse" @click="refuseList">拒绝接单</view>
		</view>

		<view v-else class="button">
			<view class="accept" @click="viewDetails">查看详情</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		props: {
			equipmentModel: {
				type: String,
				default: ""
			},
			titleDec: {
				type: String,
				default: ""
			},
			taskState: {
				type: String,
				default: ""
			},
			faultDec: {
				type: String,
				default: "",
			},
			repairAreaDec: {
				type: String,
				default: "",
			},
			contactNumberDec: {
				type: String,
				default: "",
			},
			otherStyle: {
				type: Object, // 将otherStyle的类型设置为对象
				default: () => ({
					// justifyContent: "space-around" // 设置默认样式属性
				})
			},
			tabIndex: {
				type: Number,
				default: 0
			},
			orderId: {
				type: Number,
				default: 0,
			},
			machineModelNumber:{
				type: String,
				default: "",
			}
		},
		methods: {
			acceptList() {
				this.$emit("acceptList", this.orderId);
			},
			refuseList() {
				this.$emit("refuseList", this.orderId);
			},
			viewDetails() {
				this.$emit("viewDetails", this.orderId,this.taskState,this.machineModelNumber);
			}

		}
	}
</script>

<style lang="scss">
	.general-tasks {
		min-height: 200rpx;
		width: 90vw;
		margin: 0 auto;
		border-radius: 10rpx;
		border-left: 4rpx solid #ffb612;
		border-right: 4rpx solid #ffb612;
		background-color: #4f4f4f;
		padding: 20rpx;

		.model-title {
			margin: 15rpx 0;
			display: flex;
			justify-content: space-between;
			color: #ffb612;

			.title-dec {
				font-size: 40rpx;
				font-weight: 600;
			}
		}


		.maintenance-title {
			margin: 5rpx 0;
			display: flex;
			justify-content: space-between;
			color: #cecece;
			font-size: 35rpx;
		}



		.hr {
			margin: 15rpx 0;
			border: #ffb612 1rpx solid;
		}

		.form-display {
			color: #cecece;


			.common-style {
				display: flex;
				justify-content: space-between;
				margin: 20rpx 0;
			}
		}

		.button {
			margin-top: 50rpx;
			color: white;
			display: flex;
			justify-content: space-around;

			.accept {
				padding: 15rpx 20rpx;
				font-weight: 600;
				background-color: #ffb612;
				border-radius: 10rpx;

				&:active {
					background-color: #ff55ff;
				}
			}

			.refuse {
				padding: 15rpx 20rpx;
				font-weight: 600;
				background-color: #333333;
				border-radius: 10rpx;

				&:active {
					background-color: #ff55ff;
				}
			}
		}
	}
</style>
